%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for mutations/v4/rbac.leftArmIdentity"
    Bucket0("Bucket 0 (root)"):::bucket
    Bucket1("Bucket 1 (mutationField)<br />Deps: 17, 18, 23, 24<br /><br />1: PgSelect[14]<br />2: PgSelectRows[20]<br />ᐳ: 19, 21, 22"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 22, 21, 14, 24<br /><br />ROOT Object{1}ᐸ{result}ᐳ[22]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 21, 14, 24<br /><br />ROOT PgSelectSingle{1}ᐸleft_arm_identityᐳ[21]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3

    %% plan dependencies
    __InputObject8{{"__InputObject[8∈0] ➊<br />More deps:<br />- Constantᐸ9001ᐳ[31]<br />- Constantᐸ99ᐳ[32]<br />- Constantᐸ77ᐳ[33]<br />- Constantᐸ'jubilant'ᐳ[34]"}}:::plan
    __InputObject6{{"__InputObject[6∈0] ➊<br />More deps:<br />- Constantᐸundefinedᐳ[7]"}}:::plan
    __InputObject8 --> __InputObject6
    Object17{{"Object[17∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access15{{"Access[15∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access16{{"Access[16∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access15 & Access16 --> Object17
    BakedInput13{{"BakedInput[13∈0] ➊"}}:::plan
    __InputObject8 --> BakedInput13
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access15
    __Value2 --> Access16
    PgFromExpression18{{"PgFromExpression[18∈0] ➊"}}:::plan
    BakedInput13 --> PgFromExpression18
    ApplyInput23{{"ApplyInput[23∈0] ➊"}}:::plan
    __InputObject6 --> ApplyInput23
    PgSelect14[["PgSelect[14∈1] ➊<br />ᐸleft_arm_identity(mutation)ᐳ"]]:::sideeffectplan
    Object17 & PgFromExpression18 & ApplyInput23 --> PgSelect14
    First19{{"First[19∈1] ➊"}}:::plan
    PgSelectRows20[["PgSelectRows[20∈1] ➊"]]:::plan
    PgSelectRows20 --> First19
    PgSelect14 --> PgSelectRows20
    PgSelectSingle21{{"PgSelectSingle[21∈1] ➊<br />ᐸleft_arm_identityᐳ"}}:::plan
    First19 --> PgSelectSingle21
    Object22{{"Object[22∈1] ➊<br />ᐸ{result}ᐳ"}}:::plan
    PgSelectSingle21 --> Object22
    List26{{"List[26∈3] ➊<br />ᐸ24,25ᐳ<br />More deps:<br />- Constantᐸ'left_arms'ᐳ[24]"}}:::plan
    PgClassExpression25{{"PgClassExpression[25∈3] ➊<br />ᐸ__left_arm...ity__.”id”ᐳ"}}:::plan
    PgClassExpression25 --> List26
    PgSelectSingle21 --> PgClassExpression25
    Lambda27{{"Lambda[27∈3] ➊<br />ᐸbase64JSONEncodeᐳ"}}:::plan
    List26 --> Lambda27
    PgClassExpression28{{"PgClassExpression[28∈3] ➊<br />ᐸ__left_arm...person_id”ᐳ"}}:::plan
    Object22 o--o PgClassExpression28
    PgClassExpression29{{"PgClassExpression[29∈3] ➊<br />ᐸ__left_arm...in_metres”ᐳ"}}:::plan
    PgClassExpression28 o--o PgClassExpression29
    PgClassExpression30{{"PgClassExpression[30∈3] ➊<br />ᐸ__left_arm...y__.”mood”ᐳ"}}:::plan
    PgClassExpression29 o--o PgClassExpression30

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,__InputObject6,__InputObject8,BakedInput13,Access15,Access16,Object17,PgFromExpression18,ApplyInput23 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgSelect14,First19,PgSelectRows20,PgSelectSingle21,Object22 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression25,List26,Lambda27,PgClassExpression28,PgClassExpression29,PgClassExpression30 bucket3

